package keygen.demo;

import keygen.client.DesKeyVilidate;
import keygen.client.SystemMessageUtil;
import keygen.server.DesKeyGenerator;

/**
 * 
 * @Description: 调用实例
 * @Author: zhangzuoqiang
 * @Date: Sep 20, 2011
 */
public class Demo {

	public static void main(String[] args) {
		System.out.println("KeyGen过程演示：");
		// 客户端运行安装程序etc,Machine.java 获得机器的机器码
		/*
		 * System.out.println("Machine.java 获得机器的机器码"); MachineCode mc = new
		 * MachineCode(); System.out.println("机器码为：" + mc.getMachinecode());
		 */
		String mac = SystemMessageUtil.getLocalMac().get(1);
		String key = DesKeyGenerator.DESEncrypt(mac);
		System.out.println("Mac地址码为：" + mac);
		System.out.println("序列号为：" + key);
		// 客户端激活程序验证过程
		if (DesKeyVilidate
				.validate("470DB9883B152C3961F76DD1037CB9A9EFE28AEF1C6AE788")) {
			System.out.println("序列号正确, 验证成功");
		} else {
			System.out.println("序列号错误, 验证失败");
		}
	}
}
